﻿#ifndef FORWARD_TASK_H
#define FORWARD_TASK_H

#include <QObject>
#include <QSslSocket>
#include <QThread>

//数据转发控制
class Forward_Task : public QObject
{
    Q_OBJECT
public:
    explicit Forward_Task(QTcpSocket* source,QTcpSocket* target, QObject *parent = nullptr);

signals:
    RecycleSocket(QTcpSocket *socket);
public:
    void run();
private:
    qintptr mTcpSourceDesrcption;
    qintptr mTcpTargetDesrcption;
    QTcpSocket* mTcpSource = nullptr;
    QTcpSocket* mTcpTarget = nullptr;
protected:
    
private slots:
    void forwardDataToSource();//转发信号发送者数据到其他的非发送者
    void forwardDataToTarget();
    
    void disconnected(); //任意一方的断开处理
};

#endif // FORWARD_TASK_H
